<%--
  Created by IntelliJ IDEA.
  User: zzz
  Date: 2020/2/6
  Time: 16:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8" />
    <title>${requestScope.kinds.kname}</title>
    <link rel="stylesheet" type="text/css" href="${APP_PATH}/portal/css/public.css"/>
    <link rel="stylesheet" type="text/css" href="${APP_PATH}/portal/css/proList.css"/>
</head>
<body>
<!------------------------------head------------------------------>
<jsp:include page="/WEB-INF/jsps/Portal/common/top.jsp"/>
<!-----------------banner------------------------------->
<div class="banner">
    <a href="#"><img src="${APP_PATH}/${requestScope.kinds.kface}"/></a>
</div>
<!-----------------address------------------------------->
<div class="address">
    <div class="wrapper clearfix">
        <a href="${APP_PATH}/toPortal">首页</a>
        <span>/</span>
        <a href="javascript:;" class="on">${requestScope.kinds.kname}</a>
    </div>
</div>
<!-----------------paintCon------------------------------->
<div id="allType" class="paintCon">

</div>
<!--返回顶部-->
<jsp:include page="/WEB-INF/jsps/Portal/common/gotop.jsp"/>
<div class="msk"></div>
<!--footer-->
<jsp:include page="/WEB-INF/jsps/Portal/common/bottom.jsp"/>
<script src="${APP_PATH}/portal/js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="${APP_PATH}/portal/js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="${APP_PATH}/portal/js/nav.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="js/pro.js" type="text/javascript" charset="utf-8"></script>-->
</body>
</html>

<script>
$(function () {
    getAllType();
});

    function getAllType() {
        $.ajax({
            url : "${APP_PATH}/goods/getAllKindsType",
            method : "GET",
            data : {
                kid : ${requestScope.kinds.kid}
            },
            success : function (result) {
                if(result.success){
                    var kindsTypeList = result.data.datas;
                    var kindsTypeContent = "";
                    for(var i = 0; i < kindsTypeList.length; i++){
                        kindsTypeContent +='<section class="wrapper">';
                        kindsTypeContent +='<img src="${APP_PATH}/'+kindsTypeList[i].ktface+'" />';
                        kindsTypeContent +='<div id="'+kindsTypeList[i].ktid+'" class="paintList">';
                        kindsTypeContent +='</div>';
                        kindsTypeContent +='<p style="margin-left:1050px; margin-bottom:20px;"><a style="color: #CC0000; font-size:15px;" href="${APP_PATH}/toKindsTypeGoods?kid=${requestScope.kinds.kid}&ktid='+kindsTypeList[i].ktid+'">查看更多>></a></p>';
                        kindsTypeContent +='</section>';
                        getFurnitureByKtid(kindsTypeList[i].ktid);
                    }
                    $("#allType").html(kindsTypeContent);
                }
            }
        });
    }

    function getFurnitureByKtid(ktid) {
        $.ajax({
            url : "${APP_PATH}/goods/getFurnitureByKtid",
            method : "GET",
            data : {
                ktid : ktid
            },
            success : function (result) {
                if(result.success){
                    var furnitureList = result.data.datas;
                    var furnitureContent = "";
                    for(var i = 0 ; i < furnitureList.length ; i++){
                        furnitureContent +='<a href="${APP_PATH}/toFurnitureDetail?ktid='+furnitureList[i].kt_ktid+'&fid='+furnitureList[i].fid+'">';
                        furnitureContent +='<dl>';
                        furnitureContent +='<dt><img style="width:380px;" src="${APP_PATH}/'+furnitureList[i].fface+'"></dt>';
                        furnitureContent +='<dd>'+furnitureList[i].fname+'</dd>';
                        furnitureContent +='<dd>￥'+furnitureList[i].fprice.toFixed(2)+'</dd>';
                        furnitureContent +='</dl>';
                        furnitureContent +='</a>';
                    }
                    $("#"+ktid).html(furnitureContent);
                }
            }
        });
    }
</script>